<template>
  <div class="goods">
    <!-- 搜索 -->
    <page-search
      :SearchFormConfig="SearchFormConfig"
      @handleQuerySubmit="handleQuerySubmit"
      @handleReset="handleResetClick"
    ></page-search>
    <!-- 表格数据 -->
    <page-content
      ref="pageContentRef"
      :contentTableConfig="contentTableConfig"
      pageName="goods"
    >
      <template #image="scope">
        <el-image
          style="width: 60px; height: 60px"
          :src="scope.row.imgUrl"
          :preview-src-list="[scope.row.imgUrl]"
        ></el-image>
      </template>
      <template #oldPrice="scope">{{ '￥' + scope.row.oldPrice }}</template>
      <template #newPrice="scope">{{ '￥' + scope.row.newPrice }}</template>
    </page-content>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

import { SearchFormConfig } from './config/search-config'
import { contentTableConfig } from './config/content.config'
import PageSearch from '@/base-ui/page-search'
import PageContent from '@/base-ui/page-content'
import { usePageSearch } from '@/hooks/use-page-search'
export default defineComponent({
  name: 'Goods',
  components: {
    PageSearch,
    PageContent
  },
  setup() {
    const { handleQuerySubmit, handleResetClick, pageContentRef } =
      usePageSearch()

    return {
      SearchFormConfig,
      contentTableConfig,
      handleQuerySubmit,
      handleResetClick,
      pageContentRef
    }
  }
})
</script>

<style scoped></style>
